﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Change.aspx.cs" Inherits="CustomerContactSystem.WebForms.Enquiries.Customers.Change" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h1>Enquiry: <asp:hyperlink ID="EnquiryIdCaption" runat="server"></asp:hyperlink></h1>
<h2>Change Customer</h2>
<asp:HyperLink ID="CreateNewLink" runat="server" Text="Create New Customer" NavigateUrl="~/Customers/Create.aspx" CssClass="button"></asp:HyperLink>
<fieldset id="SearchForm" runat="server" class="search-form">
    <legend>Find Customer</legend>
    
    <span class="info">Current Customer: <asp:Literal ID="CurrentCustomer" runat="server"></asp:Literal></span>

    <asp:Label ID="FirstNameCaption" runat="server" Text="First Name:" AssociatedControlID="FirstName"></asp:Label>
    <asp:TextBox ID="FirstName" runat="server"></asp:TextBox>

    <asp:Label ID="SecondNameCaption" runat="server" Text="Second Name:" AssociatedControlID="SecondName"></asp:Label>
    <asp:TextBox ID="SecondName" runat="server"></asp:TextBox>

    <asp:Label ID="AddressCaption" runat="server" Text="Address:" AssociatedControlID="Address"></asp:Label>
    <asp:TextBox ID="Address" runat="server"></asp:TextBox>

    <asp:Button ID="SearchCustomers" runat="server" Text="Search" CssClass="submit" OnClick="SearchCustomersClick" />
    <asp:Label ID="SearchResultMessage" runat="server" CssClass="error"></asp:Label>
</fieldset>

<asp:Repeater ID="CustomerList" runat="server" OnItemDataBound="CustomerListItemDataBound">
<HeaderTemplate>
<table>
    <thead>
        <tr>
            <th id="Name">Name</th>
            <th id="Address">Address</th>
            <th id="OptionsHeader" runat="server">Options</th>
        </tr>
    </thead>
    <tbody>
</HeaderTemplate>    
<ItemTemplate>
        <tr>
            <td headers="Name"><a id='<%#Eval("Id")%>'></a><%#Eval("FullName")%></td>
            <td headers="Address"><%#Eval("AddressLine")%></td>
            <td>
                <asp:HyperLink ID="UseInCurrentEnquiryLink" runat="server" Text="Change to this Customer"></asp:HyperLink>
            </td>
        </tr>
</ItemTemplate>
<FooterTemplate>
    </tbody>
</table>
</FooterTemplate>
</asp:Repeater>   
</asp:Content>